package com.xd.springaiagent.tools;

import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Service;

@Service
public class MathTool {
    @Tool(name = "add", description = "be use to calculation of sum")
    public String add(
            @ToolParam(description = "first number", required = true) int a,
            @ToolParam(description = "second number", required = true) int b
    ) {
        return String.valueOf(a + b);
    }

    @Tool(name = "subtract", description = "be use to calculation of subtract")
    public String subtract(
            @ToolParam(description = "first number", required = true) int a,
            @ToolParam(description = "second number", required = true) int b
    ) {
        return String.valueOf(a - b);
    }

    @Tool(name = "multiply", description = "be use to calculation of multiply")
    public String multiply(
            @ToolParam(description = "first number", required = true) int a,
            @ToolParam(description = "second number", required = true) int b
    ) {
        return String.valueOf(a * b);
    }

    @Tool(name = "divide", description = "be use to calculation of divide")
    public String divide(
            @ToolParam(description = "first number", required = true) int a,
            @ToolParam(description = "second number", required = true) int b
    ) {
        return String.valueOf(a / b);
    }
}
